package service;

import dao.UserDao;
import entity.User;
import util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;

public class UserService implements UserServiceInterface{
    private static UserDao userDao=UserDao.getInstance();
    private static UserService userService;
    private UserService(){}
    public static UserService getInstance() {
        if(userService==null) {
            userService=new UserService();
        }
        return userService;
    }
    @Override
    public void login(User user) throws SQLException {
        Connection connection= JdbcHelper.getConn();
        userDao.login(connection,user);
        JdbcHelper.close(connection);
    }
}
